var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
// var logger = require('morgan');
var express=require("express");
var ejs =require('ejs');

var routes = require('./routes/home');   //引用自定义路由home(要精准定位)

var app=express();

//设置是否启用视图编译缓存，启用将加快服务器执行效率
app.set("view cache",true);
//设置模板引擎的格式即运用何种模板引擎
app.set("view engine","ejs");

routes(app);        //通过传参方式传到home中

//设置模板视图的目录
app.set('views',path.join(__dirname,'views'));
//挂载静态资源处理中间件
app.use(express.static(path.join(__dirname,'public')));


app.listen(8080,function(){
  console.log('server listening on port 8080');
});

module.exports =app;

// supervisor



